]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dbusServices/extensions: Override destroy() method
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 25 Feb 2024 20:22:22 +0000 (21:22 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 1 Mar 2024 15:00:46 +0000 (15:00 +0000)
Some extensions try to destroy the provided dialog, so they can
instead show the preferences in an alternative way.

Unfortunately that is undetectable from the Extensions service,
which still thinks the dialog is open, and will therefore block
other prefs dialogs.

Try to steer extensions away from that anti-pattern (or at the
very least switch to `close()` which doesn't break) by overriding
the window's destroy() method and show an extension error instead.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7435

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3209>

js/dbusServices/extensions/extensionPrefsDialog.js

index 334640d5eff71f758c020e72b4063282be6b7d73..9e3ea57ee59478d9754cebd5e3276df4f68cf4bf 100644 (file)
@@ -58,6 +58,11 @@ export const ExtensionPrefsDialog = GObject.registerClass({
         });
     }
 
+    destroy() {
+        this._showErrorPage(
+            new Error('destroy() breaks tracking open dialogs, use close() if you must'));
+    }
+
     _showErrorPage(e) {
         while (this.visible_page)
             this.remove(this.visible_page);